﻿using GalaSoft.MvvmLight;
using System;
using GalaSoft.MvvmLight.Command;
using Microsoft.Phone.Tasks;

namespace CDFWPUG.ViewModel
{
    /// <summary>
    /// This class contains properties that a View can data bind to.
    /// <para>
    /// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
    /// </para>
    /// <para>
    /// You can also use Blend to data bind with the tool's support.
    /// </para>
    /// <para>
    /// See http://www.galasoft.ch/mvvm/getstarted
    /// </para>
    /// </summary>
    public class pageShareViewModel : ViewModelBase
    {
        /// <summary>
        /// Initializes a new instance of the pageShareViewModel class.
        /// </summary>
        public pageShareViewModel()
        {
            if (IsInDesignMode)
            {
                // Code runs in Blend --> create design time data.
            }
            else
            {
                // Code runs "for real": Connect to service, etc...
            }

            SMSMessageCommand = new RelayCommand(HandleStatusMessageCommand);
            EmailMessageCommand = new RelayCommand(HandleStatusMessageCommand);
            StatusMessageCommand = new RelayCommand(HandleStatusMessageCommand);


        }

        public override void Cleanup()
        {
            // Clean own resources if needed

            base.Cleanup();
        }

        private String _Message;
        public String Message
        {
            get
            {
                return _Message;
            }
            set
            {
                _Message = value;
                RaisePropertyChanged("Message");
            }

        }

        #region RelayCommands
        public RelayCommand SMSMessageCommand { get; set; }
        private void HandleSMSMessageCommand()
        {
            SmsComposeTask task = new SmsComposeTask()
            {
                Body=Message
            };

            task.Show();

        }

        public RelayCommand EmailMessageCommand { get; set; }
        private void HandleEmailMessageCommand()
        {
            EmailComposeTask task = new EmailComposeTask()
            {
                Body = Message
            };

            task.Show();

        }

        public RelayCommand StatusMessageCommand { get; set; }
        private void HandleStatusMessageCommand()
        {
            ShareStatusTask task = new ShareStatusTask()
            {
               Status = Message
            };

            task.Show();
        }

        #endregion
    }
}